package com.arpa.oms.domain.enums;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;


/**
 * @description
 * 销售退货单类型
 * @author xuyang
 * @date 2020/11/09
 **/
public enum OmsSaleReturnTypeEnum implements IEnum<String> {
    // XYTODO TODO 暂时无用，数据改为使用ReceiveTypeEnum
    SALE_RETURN("SALE_RETURN","销售退货"),
    ;

    /**
     * 值
     */
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    OmsSaleReturnTypeEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    private static final Map<String, OmsSaleReturnTypeEnum> map = new HashMap();

    static {
        for(OmsSaleReturnTypeEnum item: values()){
            map.put(item.getValue(), item);
        }
    }

    public static OmsSaleReturnTypeEnum getEnumByValue(String value){
        return map.get(value);
    }

    /**
     * 翻译
     * @param value
     * @return
     */
    public static String translate(String value){
        OmsSaleReturnTypeEnum item = getEnumByValue(value);
        if(item != null){
            return item.getDesc();
        }
        return StrUtil.EMPTY;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
